<?php
	include "inc/userAuth.php";
	include "inc/functions.php";
	$event = 1;
	$event_name = "";
	$event_titre = "";
	$hh = "";
	$mn = "";
	$adresse = "";
	$code = "";
	$ville = "";
	$pays = "";
	$voiture = "";
	$train = "";
	$avion = "";
	
	if(isset($_GET['event'])){
		$event = $_GET['event'];
	}
	if(isset($_SESSION['eid-'.$event])) {
		include "conn/database.php";
		$sql = "SELECT * FROM `T_EVENTS` WHERE `WEDDING_ID` = '".$_SESSION['wid']."'
		AND `INDEX` = '".$event."' limit 1";
		$res = mysql_query($sql);
		$rows = mysql_num_rows($res);
		if($rows>0){
			$result = mysql_fetch_array($res);
			$event_name = $result['EVENT_TYPE_ID'];
			$event_titre = $result['TITLE'];
			
			$date = explode(" ",$result['START_TIME']);
			$date2 = explode(":",$date[1]);
			$hh = $date2[0];
			$mn = $date2[1];
			
			$adresse = $result['STREET'];
			$code = $result['POSTAL_CODE'];
			$ville = $result['CITY'];
			$pays = $result['COUNTRY'];
			$voiture = $result['CAR_ACCESS_DESC'];
			$train = $result['TRAIN_ACCESS_DESC'];
			$avion = $result['PLANE_ACCESS_DESC'];
		}
	}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="Description" content="Une application mobile unique pour un mariage unique.">
<meta name="Keywords" content="wedding box, mariage, application mobile, appstore, google play, iphone, android, iphone 5, samsung galaxy s3, promesse d'une vie">
<title>Promesse d'une Vie</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link type="text/css" rel="stylesheet" media="screen" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.7.2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/wedding_form.js" charset="utf-8"></script>
<script type="text/javascript">	
</script>

</head>
<body>	
	<div class="main-content" id="grandjour">
		<?php
			include "left-menu.php";
		?>
		
		<div class="right">
			<div id="left-shadow"></div>
			<div class="welcome relative">
				<a id="click-drop"><span>Bonjour <?php echo $_SESSION['fname']?></span></a>
				<a type="button" class="deconnect" value="" name="deconnect" id="bien-deconnect" style="display:none;"/></a>
			</div>
			<div class="top-nav">
				<ul class="tabs">
					<?php
						for($i=1;$i<=6;$i++) { ?>
							<li><a href="grandjour.php?event=<?php echo $i; ?>" id="gj-<?php echo($i==$event?$i."_on":$i); ?>">Évènement <?php echo $i; ?></a></li>
					<?php	}	?>
				</ul>
			</div>
			<div class="title">
				<h2>Description de l'évènement <?php echo $event; ?></h2>
				<p style="font-size:14px;">Renseignez les informations concernant les différents évènements de votre mariage</p>
			</div>
			
			<form method="post" action="inc/<?php echo(isset($_SESSION['eid-'.$event])?"edit":"add"); ?>event.php" class="wedding_form relative" id="grandjour-1">
			<div class="showText"></div>
					<input type="hidden" name="addevent-step" value="<?php echo $event; ?>">
					<div class="form_text">
						<div class="form_select">
								<label>Évènement <?php echo $event; ?><sup>*</sup></label>
								
								<p class="select_show">Séléctionnez votre évènement</p>
								<div class="select_options" style="display:none;">
									<a class="select_option" val="1">Mairie<span class="selectable_opacity"></span></a>
									<a class="select_option" val="2">Eglise<span class="selectable_opacity"></span></a>
									<a class="select_option" val="3">Mosquée<span class="selectable_opacity"></span></a>
									<a class="select_option" val="4">Synagogue<span class="selectable_opacity"></span></a>
									<a class="select_option" val="5">Temple<span class="selectable_opacity"></span></a>
									<a class="select_option" val="6">Cocktail<span class="selectable_opacity"></span></a>
									<a class="select_option" val="7">Vin d'honneur<span class="selectable_opacity"></span></a>
									<a class="select_option" val="8">Dîner<span class="selectable_opacity"></span></a>
								</div>
								<input name="event_name" class="select_value" type="hidden" value="<?php echo $event_name; ?>"/>
						</div>
					</div>
						
					<div class="form_text">
							<label for="event_titre">Titre de l'évènement<sup>*</sup></label>
						  <input type="text" id="event_titre" name="event_titre" value="<?php echo $event_titre; ?>" />
					</div>
					
					<div class="form_text">
						<label>Horaire de l’évènement<sup>*</sup></label>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="hh" id="hh" class="select_value" type="hidden" value="<?php echo $hh; ?>"/>
								<p class="select_show">H</p>
								<div class="select_options" style="display:none;">
								<?php display_select_options_hours(); ?>
								</div>
							</div>
						</div>
						<div class="form_select form_select_date">
							<div class="form_select_date">
								<input name="mn" id="mn" class="select_value" type="hidden" value="<?php echo $mn; ?>"/>
								<p class="select_show">MN</p>
								<div class="select_options" style="display:none;">
									<?php display_select_options_minutes(); ?>
								</div>
							</div>
						</div>
					</div>
					
					<div class="title" style="margin:70px 0 20px;">
						<h2>Lieu et adresse</h2>
					</div>
					
					<div class="form_text">
						<label for="adresse">Adresse<sup>*</sup></label>
						<input type="text" id="adresse" name="adresse" value="<?php echo $adresse; ?>" />
					</div>
					
					<div class="form_text" style="margin-bottom:30px;">
						<div class="form_text2">
							<label for="code">Code postal<sup>*</sup></label>
							<input type="text" id="code" name="code" value="<?php echo $code; ?>" />
						</div>
						<div class="form_text2" style="margin-left:15px;">
							<label for="ville">Ville<sup>*</sup></label>
							<input type="text" id="ville" name="ville" value="<?php echo $ville; ?>" />
						</div>
					</div>
					
					<div class="form_text">
						<div class="form_select">
								<label>Pays<sup>*</sup></label>
								
								<p class="select_show">Séléctionnez votre pays</p>
								<div class="select_options" style="display:none;">
									<a class="select_option" val="GER">Allemand<span class="selectable_opacity"></span></a>
									<a class="select_option" val="CHN">Chine<span class="selectable_opacity"></span></a>
									<a class="select_option" val="FR">France<span class="selectable_opacity"></span></a>
								
								</div>
								<input name="pays" class="select_value" type="hidden" value="<?php echo $pays; ?>"/>
						</div>
					</div>
					
					
					<div class="title" style="margin:70px 0 20px;">
						<h2>Informations pratiques</h2>
					</div>
					
					<div class="form_textaera">
						<label for="voiture">Accès par voiture<sup>*</sup></label>
						<textarea id="voiture" name="voiture" cols="" rows="" style="font-size:12px;" placeholder="Précisez à vos invités toute information utile leur permettant de venir
facilement à cet évènement."><?php echo $voiture; ?></textarea>
					</div>
					
					<div class="form_textaera">
						<label for="train">Accès par train<sup>*</sup></label>
						<textarea id="train" name="train" cols="" rows="" style="font-size:12px;" placeholder="Précisez à vos invités toute information utile leur permettant de venir
facilement à cet évènement."><?php echo $train; ?></textarea>
					</div>
					
					<div class="form_textaera">
						<label for="avion">Accès par avion<sup>*</sup></label>
						<textarea id="avion" name="avion" cols="" rows="" style="font-size:12px;" placeholder="Précisez à vos invités toute information utile leur permettant de venir
facilement à cet évènement."><?php echo $avion; ?></textarea>
					</div>
					
					<div class="upload_photo">
						<p>Visuel de l'évènement <?php echo $event; ?></p>
						<input name="img_icon_data" id="img_icon_data" type="hidden" value="no" />
							
						<div class="upload_img">
							<?php if($img_url == ''){ ?><img src="images/event-nofile.png"  /><?php }else{ ?>
							<div id="sliderload_img"><a href=""><img src="<?=  $app_media.$img_url; ?>" /></a></div>
							<?php } ?>
					    </div>
							
					    <div class="upload_image">
							<input name="img_url" id="img_url" type="file" onchange="ChangeMedia()"/>
							<a href="javascript:AnnulerUpload();"><img src="img/trash.gif" title="Annuler" width="16" height="16" class="trashIcon"/></a>
					    </div>	
					</div>
					<input type="submit" value="Enregister" name="submit" class="btn-save button" style=""/>
		    </form>
				
				
		</div>
	</div>
</body>
</html>